package com.fr.report.script.function;

import com.fr.base.core.DateUtils;
import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import java.util.Date;

public class DAYSOFMONTH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    Date localDate = (paramArrayOfObject.length == 0) ? new Date() : DateUtils.object2Date(paramArrayOfObject[0], false);
    return new Integer((int)DateUtils.subtractDate(new Date(localDate.getYear(), localDate.getMonth() + 1, localDate.getDate()), new Date(localDate.getYear(), localDate.getMonth(), localDate.getDate()), "d"));
  }

  public Function.Type getType()
  {
    return Function.DATETIME;
  }

  public String getCN()
  {
    return "DAYSOFMONTH(date):返回从1900年1月后某年某月包含的天数。\n示例：\nDAYSOFMONTH(\"1900-02-01\")等于28。\nDAYSOFMONTH(\"2008/04/04\")等于30。";
  }

  public String getEN()
  {
    return "";
  }
}